package Eyjafjalla.card.skill;

import Eyjafjalla.action.MakeTempCardInCloudAction;
import Eyjafjalla.card.AbstractEyjafjallaCard;
import com.megacrit.cardcrawl.actions.common.DrawCardAction;
import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.actions.common.MakeTempCardInDiscardAction;
import com.megacrit.cardcrawl.actions.common.MakeTempCardInDrawPileAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;

public class CloudCrack_Eyjafjalla extends AbstractEyjafjallaCard {
    public static final String ID = "CloudCrack_Eyjafjalla";
    private static final CardStrings cardStrings;

    public CloudCrack_Eyjafjalla(){
        super(ID, cardStrings.NAME,1,cardStrings.DESCRIPTION,CardType.SKILL,CardRarity.COMMON,CardTarget.SELF);
        this.baseBlock = 6;
        this.block = 6;
        this.baseMagicNumber = 2;
        this.magicNumber = 2;
        this.exhaust = true;
        setFireDescription(cardStrings.EXTENDED_DESCRIPTION[0]);
    }

    @Override
    public AbstractCard makeCopy() {
        return new CloudCrack_Eyjafjalla();
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        addToBot(new GainBlockAction(p,this.block));
        if(isFire()){
            addToBot(new DrawCardAction(1));
        }
        addToBot(new MakeTempCardInDiscardAction(getCopyCard(),1));
    }

    private AbstractCard getCopyCard(){
        AbstractCard co = this.makeStatEquivalentCopy();
        co.baseBlock = this.baseBlock + this.baseMagicNumber;
        co.block = co.baseBlock;
        return co;
    }

    @Override
    public void upgrade() {
        if(!this.upgraded){
            upgradeName();
            upgradeBlock(2);
            upgradeMagicNumber(1);
        }
    }

    static {
        cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    }
}


